package com.ruoyi.integration.controller;

import com.ruoyi.integration.response.WeatherResponse;
import com.ruoyi.integration.response.DustResponse;
import com.ruoyi.integration.service.impl.WeatherStationDataServiceImpl;
import com.ruoyi.integration.service.impl.DustMonitorDataServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

@Api(value = "物联网数据服务相关接口")
@RestController
@RequiredArgsConstructor
@RequestMapping("/integration/iotData")
public class IoTDataController {

    private final DustMonitorDataServiceImpl dustMonitorDataService;

    private final WeatherStationDataServiceImpl weatherStationDataService;


    @GetMapping("/weather")
    @ApiOperation(value = "获取气象站数据接口(用于测试)")
    public WeatherResponse fetchWeatherData() throws ExecutionException {
        return weatherStationDataService.fetchData("DB632091931E0D3700");
    }

    @GetMapping("/dust")
    @ApiOperation(value = "获取 气象和粉尘监测仪 数据接口(用于测试)")
    public DustResponse fetchDustData() throws ExecutionException {
        return dustMonitorDataService.fetchData();
    }


}
